<?php 
/*
 *  NAVTOP 导航
 * 
 */

class Model_Core_Navtop{
	
	public function navtop($kind, $url, $class="-1", $sub="-1"){
		

		$subnav = new Model_Dbtable_Wowmenusub();
		$subnav = $subnav->subnav($class);
		
		$classnav = new Model_Dbtable_Wowmenuclass();
		$classnav = $classnav->classnav($url);
		
		$navtop = "";
		$navbottom = "";
		
		if ($subnav){
			foreach ($subnav as $value){
				if ($value[sub_id] == $sub){
					$id = "list_showbottomnav";
				}else{
					$id = "";
				}
				$navbottom .= "<li id=\"$id\"><a href=\"/$kind/$url?class=$class&sub=$value[sub_id]\">$value[sub_name]</a></li>";
			}
		}
		
		if ($classnav){
			foreach ($classnav as $value){
				if ($value[class_id] == $class){
					$id = "list_shownav";
				}else{
					$id = "";
				}
				$navtop .= "<li id=\"$id\"><a href=\"/$kind/$url?class=$value[class_id]\">$value[class_name]</a></li>";
			}
		}
		
		$list_nav = array(
			'navtop'  	=> $navtop,
			'navbottom' => $navbottom
		);
		
		return $list_nav;
	}
	
}